"use strict";
let emps = [
    { id: 1, name: "小王", dept: "管理部门", manage: 0, age: 45 },
    { id: 2, name: "小张", dept: "研发部门", manage: 1, age: 23 },
    { id: 3, name: "小刘", dept: "前端开发", manage: 2, age: 24 },
];
function showAllEmps(emps) {
    emps.forEach(item => {
        console.log(item);
    });
}
function findManage(name, emps) {
    const emp = emps.find(item => item.name = name);
    const manageId = emp === null || emp === void 0 ? void 0 : emp.manage;
    const manage = emps.find(item => item.id == manageId);
    if (manage) {
        return manage;
    }
    else {
        return "没有上级";
    }
}
function totalMember(emps) {
    const map = new Map();
    emps.forEach(item => {
        let temp = map.get(item.dept) ? map.get(item.dept) : 0;
        if (temp != 0) {
            temp += 1;
            map.set(item.dept, temp);
        }
        else {
            map.set(item.dept, 1);
        }
    });
    return map;
}
function findEmpByName(name, emps) {
    const emp = emps.find(item => item.name.includes(name));
    return emp;
}
function findMaxEmp(emps) {
    //先找最大的年龄是多少
    const maxAge = Math.max(...emps.map(item => item.age));
    emps.find(item => item.age == maxAge);
    emps.filter(item => item.age == maxAge);
}
